﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OA.Manager;
using OA.Model;

namespace OA.Bll
{
    public class JobPostPresenter
    {
        public string GetAllJobPost()
        {
            JobPostManager jobPostManager = new JobPostManager();
            List<JobPostInfo> list = jobPostManager.GetAllJobPosts();
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("[");
            foreach (JobPostInfo jobPost in list)
            {
                stringBuilder.Append("{");
                if (jobPost != null)
                    stringBuilder.Append(string.Format("\"id\": \"{0}\", \"text\": \"{1}\"",
                                                       jobPost.Id,
                                                       jobPost.PostName));
                stringBuilder.Append("},");
            }
            stringBuilder.Remove(stringBuilder.ToString().Length - 1, 1);
            stringBuilder.Append("]");
            return stringBuilder.ToString();
        }
    }
}
